package org.dce.screencapturer.actions.drawing;

import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;

import org.dce.screencapturer.ImageTransferer;
import org.dce.screencapturer.actions.DrawingAction;
import org.dce.screencapturer.util.IconFactory;

@SuppressWarnings("serial")
public class CopyToClipboardAction extends DrawingAction {

	public CopyToClipboardAction(){
		super(
			"categories.edit",
			"actions.copyToClipboard",
			IconFactory.getIcon("/images/edit-copy.png"));
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		

		final BufferedImage image = getDrawing().toImage();

		Toolkit
			.getDefaultToolkit()
			.getSystemClipboard()
			.setContents(new ImageTransferer(image), getDrawing());
		
	}

}
